package cn.fuego.busrental.ui.StyleTour;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import cn.fuego.busrental.R;
import cn.fuego.misp.ui.list.MispListActivity;
import cn.fuego.misp.ui.pop.MispPopListWindow;
import cn.fuego.misp.ui.pop.MispPopWindowListener;

public class NearByPlayActivity extends MispListActivity<String> {
	
	private TextView aimPlace,busStyle;

	private List<String> list=new ArrayList<String>();
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	}

	
	@Override
	protected void initData() {
		list.add("1");
		list.add("1");
		list.add("1");
		list.add("1");
		this.refreshList(list);
	}


	@Override
	public void initRes() {
		this.activityRes.setAvtivityView(R.layout.activity_near_by_play);
		this.listViewRes.setListView(R.id.route_select_listview);
		this.listViewRes.setListItemView(R.layout.item_near_play);	
	   
		this.activityRes.getButtonIDList().add(R.id.select_aim_place_btn);
	    this.activityRes.getButtonIDList().add(R.id.select_bus_style_btn);
	    this.activityRes.getButtonIDList().add(R.id.neayby_play_find_btn);
		
	}
	
	
	
	@Override
	protected void initView() {
	  aimPlace=(TextView) findViewById(R.id.true_aim_place);
	  busStyle=(TextView) findViewById(R.id.true_bus_style);
	}


	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.select_aim_place_btn:
			String[] menuItems= {
					"南昌",
					"深圳"};
			List<String> list = Arrays.asList(menuItems);	
			MispPopListWindow popWin = new MispPopListWindow(this,new MispPopWindowListener(){
				@Override
				public void onConfirmClick(String value)
				{
					aimPlace.setText(value);
					
				}
			},list);
			popWin.setLocation(MispPopListWindow.SHOW_CENTER);
			popWin.setTitle("目的地");
			popWin.setShowTitleFlag(true);
			popWin.showWindow(v,null);
			break;
			
	    case R.id.select_bus_style_btn:
	    	String[] menuItems1= {
					"飞机",
					"大炮"};
			List<String> list1 = Arrays.asList(menuItems1);	
			MispPopListWindow popWin1 = new MispPopListWindow(this,new MispPopWindowListener(){
				@Override
				public void onConfirmClick(String value)
				{
					busStyle.setText(value);
					
				}
			},list1);
			popWin1.setLocation(MispPopListWindow.SHOW_CENTER);
			popWin1.setTitle("车型");
			popWin1.setShowTitleFlag(true);
			popWin1.showWindow(v,null);
			
			break;

        case R.id.neayby_play_find_btn:
        	SearchNearPlayActivity.jump(this);
			break;
		default:
			break;
		}
	}


	public static void jump(Context context)
	{
		Intent intent = new Intent();
		intent.setClass(context, NearByPlayActivity.class);		
		context.startActivity(intent);
	}

	@Override
	public View getListItemView(View view, String item) {
		
		return view;
	}
}
